import { Input } from "antd";
import { useState } from "react";

const { Search } = Input;
const CustomSearch = ({ onSearch }) => {
  const [value, setValue] = useState("");

  const handleSearch = () => {
    onSearch(value);
  };

  const handleChange = (e) => {
    setValue(e.target.value);
  };

  return (
    <Search
      placeholder="Search"
      allowClear
      value={value}
      onChange={handleChange}
      onSearch={handleSearch}
    />
  );
};

export default CustomSearch;
